package com.yzh.openai.infrastructure.repository;

import com.yzh.openai.domain.auth.model.entity.UserEntity;
import com.yzh.openai.domain.auth.repository.IUserRepository;
import com.yzh.openai.infrastructure.dao.UserAccountMapper;
import com.yzh.openai.infrastructure.po.UserAccountPO;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;

/**
 * 用户仓储服务
 */
@Repository
public class UserRepository implements IUserRepository {
    @Resource
    private UserAccountMapper userAccountMapper;
    @Override
    public UserEntity queryUserInfo(String openid) {
        UserAccountPO userAccountPO = userAccountMapper.queryUserInfo(openid);
        UserEntity userEntity = new UserEntity();
        userEntity.setOpenid(userAccountPO.getOpenid());
        userEntity.setSurplusQuota(userAccountPO.getSurplusQuota());
        userEntity.setStatus(userAccountPO.getStatus());
        
        return userEntity;
    }
}
